import axios from "axios";

export function request(config) {
    const instance = axios.create({
        baseURL: 'https://api.shop.eduwork.cn',
        timeout: 5000
    })
    //请求拦截
    instance.interceptors.request.use(
        config => {
            //接口需要认证
            return config
        },
        err => {
            //请求一般没有错误
        })

    //响应拦截
    instance.interceptors.response.use(
        res => {
            return res
        },
        err => {
            //登录授权，统一跳转到登录页面
            //有错误时，非200
        }
    )

    return instance(config)
}
